﻿//using System;
//using System.Linq.Expressions;

//namespace NiuX.Common.Tests.Dapper;

//public class DbOperationBuilder<T>
//{
//    public DbQuerableContextModel<T> ContextModel { get; set; } = new();

//    public DbOperationBuilder<T> BuildWhere(Expression<Func<T, bool>> expression)
//    {
//        ContextModel.WhereExpression = expression;

//        return this;
//    }

//    public DbOperationBuilder<T> BuildOrderBy(string field)
//    {
//        //WhereExpression = expression;
//        ContextModel.OrderByFields = field.Split(',');
//        ContextModel.IsDescending = false;

//        return this;
//    }

//    public DbOperationBuilder<T> BuildOrderBy(string[] fields)
//    {
//        //WhereExpression = expression;
//        ContextModel.OrderByFields = fields;
//        ContextModel.IsDescending = false;

//        return this;
//    }

//    public DbOperationBuilder<T> BuildOrderByDescending(string field)
//    {
//        ContextModel.OrderByFields = field.Split(',');
//        ContextModel.IsDescending = true;
//        return this;
//    }

//    public DbOperationBuilder<T> BuildOrderByDescending(string[] fields)
//    {
//        ContextModel.OrderByFields = fields;
//        ContextModel.IsDescending = true;
//        return this;
//    }

//    public DbOperationBuilder<T> BuildSelect(Expression<Func<T, T>> expression)
//    {
//        ContextModel.SelectExpression = expression;
//        return this;
//    }

//    public DbOperationBuilder<T, TResult> BuildSelect<TResult>(Expression<Func<T, TResult>> expression)
//    {
//        var builder = new DbOperationBuilder<T, TResult>
//        {
//            ContextModel = new DbQuerableContextModel<T>
//            {
//                ConnectionString = ContextModel.ConnectionString,
//                TableName = ContextModel.TableName,
//                SelectExpression = expression,
//                WhereExpression = ContextModel.WhereExpression,
//                OrderByFields = ContextModel.OrderByFields,
//                IsDescending = ContextModel.IsDescending,
//                SelectedFields = ContextModel.SelectedFields,
//            }
//        };

//        return builder;
//    }

//    public DbOperationBuilder<T> BuildSelect(string[] fields)
//    {
//        ContextModel.SelectedFields = fields;

//        return this;
//    }

//    public DbOperationBuilder<T> BuildSelect(string field)
//    {
//        //WhereExpression = expression;
//        ContextModel.SelectedFields = field.Split(',');

//        return this;
//    }

//    public DbOperationBuilder<T> BuildTableName(string tableName)
//    {
//        ContextModel.TableName = tableName;
//        return this;
//    }
//}

//public class DbOperationBuilder<T, TResult>
//{
//    public DbQuerableContextModel<T> ContextModel { get; set; } = new();
//}
